/**
 * Copyright 2018 人人开源 http://www.renren.io
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * <p>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */

package com.yx.admin.server.controller.sys;

import com.baomidou.mybatisplus.plugins.Page;
import com.yx.common.core.model.PageModel;
import com.yx.common.web.BaseController;
import com.yx.common.web.model.ResultModel;
import com.yx.common.web.util.ResultUtil;
import com.yx.job.model.ScheduleJobLogEntity;
import com.yx.job.rpc.api.ScheduleJobLogService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 定时任务日志
 *
 * @author  TangHuaLiang
 * @since 2018-08-11
 */
@Slf4j
@Api(value = "定时任务日志管理", description = "定时任务日志管理")
@RestController
@RequestMapping("/scheduleJobLog")
public class ScheduleJobLogController extends BaseController {
	@Autowired
	private ScheduleJobLogService scheduleJobLogService;
	
	/**
	 * 定时任务日志列表
	 */
	@PostMapping("/selectPage")
	public ResultModel list(@RequestBody PageModel pageModel){
		Page<ScheduleJobLogEntity> page = scheduleJobLogService.selectPage(pageModel);

		return ResultUtil.ok(page);
	}
	
	/**
	 * 定时任务日志信息
	 */
	@GetMapping("/select/{logId}")
	public ResultModel info(@PathVariable("logId") Long logId){
		ScheduleJobLogEntity log = scheduleJobLogService.selectById(logId);

		return ResultUtil.ok(log);
	}
}
